package StudyCode.summary.myfile;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

import java.io.IOException;
import java.util.Arrays;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ByteBase64 {
	public static void main(String[] argv) {
		try {
			byte[] buf = new byte[]{0x12, 0x23};
			String s = new BASE64Encoder().encode(buf);
			System.out.println("byte 转为 Base64: " + s);
			buf = new BASE64Decoder().decodeBuffer(s);
			System.out.println("Base64 转为 byte: " + Arrays.toString(buf));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
